package securiy;


import mapper.SysUserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import entity.SysUser;

/**
 * 自定义实现UserDetailsService接口
 * @author Administrator
 *@EnableMongoRepositories(basePackages="mapper" ) 
 */

@Service
public class CustomUserService implements UserDetailsService{
	
	@Autowired
	   private SysUserRepository sysUserRepository;
	
	@Override
	public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException{
		SysUser user = sysUserRepository.findByUsername(username);
		return user;
		
	}

}
